var
    angular = require("angular");
angular
    .module("homeModule", [
        "utilsModule",
        "componentsModule",
        "homeCmptRecommendModule",
    ])
    .controller("homeCtrl", [
        "$scope",
        "sanHttp",
        function($scope, sanHttp) {
            var
                _vm_ = this;

            _vm_.nextSwiper = nextSwiper;
            _vm_.search = search;

            init();

            function init() {
                _vm_.mainText = "这是首页";
                _vm_.imgList = [{
                    url: "../res/img/1.jpg",
                    alt: "图片1"
                }, {
                    url: "../res/img/2.jpg",
                    alt: "图片2"
                }, {
                    url: "../res/img/3.jpg",
                    alt: "图片3"
                }];
                _vm_.swiper = {};
                _vm_.recommendList = [
                    {
                        name: "mc",
                        imgUrl: "../res/img/recommend1.jpg",
                    },
                    {
                        name: "mc1",
                        imgUrl: "../res/img/recommend2.jpg",
                    },
                    {
                        name: "mc2",
                        imgUrl: "../res/img/recommend3.jpg",
                    },
                    {
                        name: "mc3",
                        imgUrl: "../res/img/recommend4.jpg",
                    },
                    {
                        name: "mc3",
                        imgUrl: "../res/img/recommend4.jpg",
                    },
                    {
                        name: "mc3",
                        imgUrl: "../res/img/recommend4.jpg",
                    },
                    {
                        name: "mc3",
                        imgUrl: "../res/img/recommend4.jpg",
                    }
                ] 
            }

            function nextSwiper() {
                _vm_.swiper.nextSwiper();
            }

            function search(val) {
                sanHttp.http({
                    url: "http://192.168.1.5:9097/login",
                    data: {
                        loginName: "admin",
                        password: val
                    },
                    method: "post"
                });
            }


        }
    ]);